package com.jman.login.controller;

import com.jman.login.dto.LoginFormDTO;
import com.jman.login.dto.Result;
import com.jman.login.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/login")
public class LoginController {

    @Resource
    private LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody LoginFormDTO loginFormDTO){
        return loginService.login(loginFormDTO);
    }

    /*测试*/
    @GetMapping("/json")
    public LoginFormDTO hello(){
        LoginFormDTO loginFormDTO = new LoginFormDTO();
        loginFormDTO.setPhone("18185131307");
        loginFormDTO.setPassword("ywk_9911");
        loginFormDTO.setIsSuperior(Boolean.TRUE);
        return loginFormDTO;
    }
}
